#include <iostream>
using namespace std;

int f(string s){
    int t = 0;
    for(int i=0;i<s.size();i++){
        t = t*10+s[i]-'0';
        if(t%(i+1)!=0)    return false;
    }
    return true;
}

signed main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        if(f(s))    cout<<"Yes\n";
        else    cout<<"No\n";
    }
    return 0;
}
